package com.myh.gulimall.search.web;

import com.myh.gulimall.search.service.MallSearchService;
import com.myh.gulimall.search.vo.SearchParam;
import com.myh.gulimall.search.vo.SearchResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @Description: // 类说明，在创建类时要填写
 * @ClassName: SearchController    // 类名，会自动填充
 * @Author: MYH          // 创建者
 * @Date: 2024/5/20 15:27   // 时间
 * @Version: 1.0     // 版本
 */
@Controller
public class SearchController {

    @Autowired
    private MallSearchService mallSearchService;
    @RequestMapping("/list.html")
    public String listPage(SearchParam param, Model model) {
        //1、根据传递来的页面查询参数，去es当中检索商品
        SearchResponse result = mallSearchService.search(param);
        model.addAttribute("result", result);
        return "list";
    }
}
